package com.example.wyz.classplus.base;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

import io.reactivex.disposables.Disposable;

/**
 * Created by 10153 on 2017/5/21.
 */

public class BasePresenter<GV extends IBaseView, GM extends IBaseModel> {

    protected GV mView;
    protected GM mModel;

    protected Context mContext;

    protected List<Disposable> mDisposables = new ArrayList<>();



//    public BasePresenter(Activity mContext, GV mView){
//        this.mContext = mContext;
//        this.mView = mView;
//    }

    public void onCreate(){

    }

    public void onDestroy(){

    }

    public void startActivity(Class<?> cls){
        Intent intent = new Intent(this.mContext, cls);
        mContext.startActivity(intent);
    }

    public void startActivity(Class<?> cls, Bundle bundle){
        Intent intent = new Intent(this.mContext, cls);
        intent.putExtra("data", bundle);
        mContext.startActivity(intent);
    }

    public void startActivityForResult(Class<?> cls, int requestCode){
        Intent intent = new Intent(this.mContext, cls);
        ((Activity)mContext).startActivityForResult(intent, requestCode);
    }
}
